package cn.diancan.model.types;

public enum UserFunctionType {
    
   
    
    /**首页刷新置顶*/	INDEXREFRESHTOP(1,"首页刷新置顶"),
    /**首页自动置顶*/	INDEXAUTOGOTOP(2,"首页自动置顶");
    
    
    private Integer functionId; 
    private String description;
    
    
    private UserFunctionType(Integer functionId, String description) {
	this.functionId = functionId;
	this.description = description;
    }
    
    /**
     * 检查值是否存在
     * @param type
     * @return
     */
    public static boolean checkExists(Integer functionId){
	if(null==functionId){
	    return false;
	}
	UserFunctionType enums[] =UserFunctionType.values();
	for (int i = 0; i < enums.length; i++) {
	    UserFunctionType singleEnum=  enums[i];
	    if(singleEnum.getFunctionId().equals(functionId)){
		return true;
	    }
	}
	return false;
    }
    
    /**
     * 根据functionId 返回描述
     * @return
     */
    public static String findById(Integer functionId){
    	if(null==functionId){
    	    return "";
    	}
    	return UserFunctionType.values()[functionId-1].getDescription();
    	
    } 
    
    public Integer getFunctionId() {
        return functionId;
    } 

    public String getDescription() {
        return description;
    }

}
